import  React from "react";
import '../css/input.css';
import eventEmitter from '../event'

class Inputs extends React.Component{
    constructor(props){
        super(props);
        this.state={

        }
    }

    render(){
        return(
            <div>
  <div className="inputnull"></div>
            <div className='input_border'>
                <input type='text' ref='input'/> 
                
                <button onClick={()=>{
                    console.log(this.refs.input.value)
                    let value=this.refs.input.value;

                    if(value.length===0){//非空判断
                        alert("不能为空")
                    }
                    var data=new Date();
                    var dateStr=`${data.getFullYear()}年${data.getMonth()+1}月${data.getDate()}日${data.getHours()}时${data.getMinutes()}分${data.getSeconds()}秒`
                    var message={
                        content:value,
                        data:dateStr

                    }
                    localStorage
                    eventEmitter.emit("content",message)
                
                
                }}>添加</button>
            </div>
            </div>
          
        )
    }
} 

export default Inputs